$(document).ready(function(){
	$("form").submit(function(){
		$("input[name='posttype']+span").css("display","none");
		$.post("AddPostType.do",$("form").serialize(),function(result){
			result = eval('(' + result + ')');
			if(result != undefined && result != null){
				if(result.status != undefined){
					if(result.status == 'ok'){
						alert("添加帖子分类成功");
						window.location.href="ListPostType.do";
					}else if(result.status == 'error'){
						alert(result.msg);
					}
				}
				if(result.name != undefined){
					$("input[name='posttype']+span").html("<i class=\"icon iconfont\">&#xe624;</i>" + result.name);
					$("input[name='posttype']+span").css("display","inline-block");
				}
			}else{
				alert("系统错误");
			}
		});
		return false;
	});
})